package com.jicheng.mapper;

import com.jicheng.dto.task.PagingTaskParams;
import com.jicheng.dto.task.PagingTemplateParams;
import com.jicheng.dto.task.TaskDetailDto;
import com.jicheng.dto.task.TemplateDto;
import com.jicheng.entity.Task;
import com.jicheng.framework.mybatis.mapper.BaseMapper;
import lombok.Data;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TaskMapper extends BaseMapper<Task> {


    /**
     * 获取任务列表
     * @param params
     * @return
     */
    List<Task> getList(PagingTaskParams params);

    /**
     * 获取任务总数
     * @param params
     * @return
     */
    Long getCount(PagingTaskParams params);

    @Select("select count(1) from tb_task where id = #{taskId}")
    int isExist(@Param("taskId") String taskId);

    @Delete("delete from tb_task where id = #{id}")
    void delTask(@Param("id") String id);


    List<TemplateDto> getBusTemplateList(PagingTemplateParams params);

    TaskDetailDto getTaskDetail(@Param("taskId") String taskId);

    @Select("select distinct  mission_type from tb_task")
    List<String> getTaskType();
    @Select("select distinct  type from tb_template where type is not null")
    List<String> getTemplateType();
}